
#git checkout ./Inc/FreeRTOSConfig.h
# git checkout ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c
#cp ./User/GCC ./Middlewares/Third_Party/FreeRTOS/Source/portable/ -r
#rm ./Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS -r

echo \
"
uint32_t *vTaskStackAddr(void)
{
    return pxCurrentTCB->pxStack;
}

uint32_t vTaskStackSize(void)
{
    return (uint32_t)(abs(pxCurrentTCB->pxTopOfStack - pxCurrentTCB->pxStack));
}

char * vTaskName(void)
{
    return pxCurrentTCB->pcTaskName;
}
" >> ./Middlewares/Third_Party/FreeRTOS/Source/tasks.c
#sed -i 's/ADC_CHANNEL_TEMPSENSOR/CHANNEL_TEMPSENSOR/g' Src/adc.c
sed -i 's/hadc->DMA_Handle->XferHalfCpltCallback = ADC_DMAHalfConvCplt;/  /g' Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c
#sed -i 's/HardFault_Handler(/HardFault_Handler1(/g' Src/stm32h7xx_it.c
#sed -i 's/NMI_Handler(/NMI_Handler1(/g' Src/stm32h7xx_it.c
#sed -i 's/MemManage_Handler(/MemManage_Handler1(/g' Src/stm32h7xx_it.c
#sed -i 's/BusFault_Handler(/BusFault_Handler1(/g' Src/stm32h7xx_it.c
#sed -i 's/UsageFault_Handler(/UsageFault_Handler1(/g' Src/stm32h7xx_it.c
#sed -i 's/DebugMon_Handler(/DebugMon_Handler1(/g' Src/stm32h7xx_it.c
#sed -i 's/#define configTOTAL_HEAP_SIZE.*/#define configTOTAL_HEAP_SIZE                    ((size_t)24*1024*1024)/g' Inc/FreeRTOSConfig.h

rm Src/sed*
rm Inc/sed*